﻿using System;
using System.Collections.Generic;

namespace CoreLibrary.Collection {

    public static class CollectionExtension {

        public static void ForEach<T>(this IEnumerable<T> ranges, Action<T> action) {
            foreach (var item in ranges) {
                action(item);
            }
        }

        public static void ForEach<T>(this IEnumerable<T> ranges, Action<int, T> action) {
            var index = 1;
            foreach (var item in ranges) {
                action(index++, item);
            }
        }

    }

}